home *** CD-ROM | disk | FTP | other *** search
Korn shell script | 1996-06-24 | 1.1 KB | 41 lines |
- #!/bin/ksh
- #
- # Script to create a directory on hard disk with links pointing to files
- # on CD-ROM, converting UPPER.CSE;1 files to lower.cse symbolic links.
- #
- # Usage: symlink.scr [CD-ROM directory start] [HD directory start]
- #
- if [[ $# -ne 2 ]]
- then
- echo This script attempts to create a directory tree that mirrors
- echo the tree specified, but contains only lower-case filenames,
- echo and omits any ;1 version numbers that may be present in the
- echo file name. This is useful to make lower-case pointers to
- echo a CD-ROM mounted on an HP-UX system, which mounts the disk
- echo with upper case filenames, and the version number.
- echo
- echo Usage: $0 [absolute CD-ROM directory] [HD directory]
- echo ie: $0 /mnt/cdrom/CALLBK callbk
- exit 1
- fi
-
- if [[ ! -d /$1 ]]
- then
- echo "$1 must be an absolute directory path (starting with '/')"
- exit 1
- fi
-
- if [[ ! -d $2 ]]
- then
- if mkdir $2
- then
- echo Failed to create directory ${2}!
- exit 1
- fi
- fi
-
- for i in $1/*\;1
- do
- ln -s ${i} ${2}/$(basename ${i} \;1 | tr [[:upper:]] [[:lower:]])
- done
-